"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var fly_in_1 = require("app/comm-components/animations/fly-in");
var main_menu_service_1 = require("../lib/service/main-menu.service");
var router_1 = require("@angular/router");
var main_header_component_1 = require("../comm-components/main-header/main-header.component");
var MainComponent = /** @class */ (function () {
    function MainComponent(mainMenuService, router) {
        var _this = this;
        this.mainMenuService = mainMenuService;
        this.router = router;
        this.hasHeaderAdditional = true;
        this.hasAside = true;
        this.mainMenuService.eventbus.subscribe(function (_event) {
            if (_event.type === 1) {
                _this.hasHeaderAdditional = !(_event.url === '/main/index');
                _this.hasAside = !(_event.url === '/main/index');
                _this.mainHeader.getAuthStatus();
            }
        });
    }
    MainComponent.prototype.ngOnInit = function () {
        var _this = this;
        this.hasHeaderAdditional = !(this.router.url === '/main/index');
        this.hasAside = !(this.router.url === '/main/index');
        this.router.events.subscribe(function (event) {
            if (event instanceof router_1.NavigationEnd) {
                if (event.urlAfterRedirects) {
                    _this.mainMenuService.eventbus.emit({
                        type: 1,
                        url: event.urlAfterRedirects
                    });
                }
                else {
                    _this.mainMenuService.eventbus.emit({
                        type: 1,
                        url: event.urlAfterRedirects
                    });
                }
            }
        });
    };
    __decorate([
        core_1.ViewChild(main_header_component_1.MainHeaderComponent)
    ], MainComponent.prototype, "mainHeader", void 0);
    MainComponent = __decorate([
        core_1.Component({
            selector: 'app-main',
            templateUrl: './main.component.html',
            styleUrls: ['./main.component.scss'],
            animations: [
                fly_in_1.flyIn
            ],
            providers: [
                main_menu_service_1.MainMenuService
            ]
        })
    ], MainComponent);
    return MainComponent;
}());
exports.MainComponent = MainComponent;
